//
//									AggNewa.h
//

#ifndef __AGG_NEWA_H
#define __AGG_NEWA_H

#include "GraphicsBase.h"
#include "xagg_base.h"

namespace newa_agg
{
	class RenBase
	{
	public:
		RenBase( newa::PixBuf& pbuf )
			:	m_pixf( m_rbuf ),
				m_rbase( m_pixf )
		{
			newa::Rect r( pbuf.rect() );
			m_rbuf.attach
				(
					reinterpret_cast<agg::int8u *>( pbuf.buf() ),
					r.width, 
					r.height, 
					r.width * newa::PixelFormat::BYTES_PER_PIXEL
				);
			m_pixf.attach( m_rbuf );
			m_rbase.attach( m_pixf );
		}
		
		xagg::ren_base& rbase()
		{
			return m_rbase;
		}

	private:
		agg::rendering_buffer m_rbuf;
		xagg::pixfmt m_pixf;
		xagg::ren_base m_rbase;
	};
}

#endif

